<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<ol>
    <li>
        test1
    </li>
    <li>
        test2
    </li>
    <li id="test3">
        test3
    </li>
</ol>
<script>
    let o1 = document.getElementsByTagName('ol')[0];
    //创建一个节点
    let li1 = document.createElement('li');
    //在一个节点里面写入值 就像手写<li>我是后面添加的li元素</li>
    li1.innerHTML = '我是替换的li元素';

    let li_test3 = document.getElementById('test3');
    li_test3.parentNode.replaceChild(li1,li_test3);


</script>
</body>
</html>